.class public Les/c10;
.super Ljava/lang/Object;
.source "Connector2.java"


# direct methods
.method public static a(Landroid/bluetooth/BluetoothDevice;Ljava/util/UUID;)Les/sp0;
    .locals 7
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    invoke-virtual {p0, p1}, Landroid/bluetooth/BluetoothDevice;->createRfcommSocketToServiceRecord(Ljava/util/UUID;)Landroid/bluetooth/BluetoothSocket;

    move-result-object p1

    .line 2
    :try_start_0
    invoke-virtual {p1}, Landroid/bluetooth/BluetoothSocket;->connect()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1

    :catch_0
    move-exception v0

    .line 3
    :try_start_1
    invoke-virtual {p1}, Landroid/bluetooth/BluetoothSocket;->close()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    :catch_1
    const/4 p1, 0x0

    .line 4
    :try_start_2
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v1

    const-string v2, "createRfcommSocket"

    const/4 v3, 0x1

    new-array v4, v3, [Ljava/lang/Class;

    sget-object v5, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;

    const/4 v6, 0x0

    aput-object v5, v4, v6

    invoke-virtual {v1, v2, v4}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v1

    new-array v2, v3, [Ljava/lang/Object;

    .line 5
    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    aput-object v3, v2, v6

    invoke-virtual {v1, p0, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Landroid/bluetooth/BluetoothSocket;
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_3

    const-wide/16 v1, 0xc8

    .line 6
    :try_start_3
    invoke-static {v1, v2}, Ljava/lang/Thread;->sleep(J)V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_2

    .line 7
    :catch_2
    :try_start_4
    invoke-virtual {p0}, Landroid/bluetooth/BluetoothSocket;->connect()V
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_4

    move-object p1, p0

    goto :goto_0

    :catch_3
    move-object p0, p1

    .line 8
    :catch_4
    invoke-virtual {p0}, Landroid/bluetooth/BluetoothSocket;->close()V

    :goto_0
    if-eqz p1, :cond_0

    .line 9
    :goto_1
    new-instance p0, Les/je0;

    new-instance v0, Les/a10;

    invoke-direct {v0, p1}, Les/a10;-><init>(Landroid/bluetooth/BluetoothSocket;)V

    new-instance p1, Les/ke0;

    invoke-direct {p1}, Les/ke0;-><init>()V

    invoke-direct {p0, v0, p1}, Les/je0;-><init>(Les/pp0;Les/ke0;)V

    return-object p0

    .line 10
    :cond_0
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 11
    new-instance p0, Ljava/io/IOException;

    const-string p1, "bluetooth connect error"

    invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p0
.end method

.method public static a(Ljava/lang/String;Ljava/util/UUID;)Les/xp0;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 12
    invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper;

    move-result-object v0

    if-nez v0, :cond_0

    .line 13
    invoke-static {}, Landroid/os/Looper;->prepare()V

    .line 14
    :cond_0
    invoke-static {}, Landroid/bluetooth/BluetoothAdapter;->getDefaultAdapter()Landroid/bluetooth/BluetoothAdapter;

    move-result-object v0

    if-eqz v0, :cond_1

    .line 15
    invoke-virtual {v0, p0, p1}, Landroid/bluetooth/BluetoothAdapter;->listenUsingRfcommWithServiceRecord(Ljava/lang/String;Ljava/util/UUID;)Landroid/bluetooth/BluetoothServerSocket;

    move-result-object p0

    .line 16
    new-instance p1, Les/we0;

    new-instance v0, Les/b10;

    invoke-direct {v0, p0}, Les/b10;-><init>(Landroid/bluetooth/BluetoothServerSocket;)V

    new-instance p0, Les/ke0;

    invoke-direct {p0}, Les/ke0;-><init>()V

    invoke-direct {p1, v0, p0}, Les/we0;-><init>(Les/qp0;Les/ke0;)V

    return-object p1

    .line 17
    :cond_1
    new-instance p0, Ljava/io/IOException;

    const-string p1, "not support bluetooth"

    invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p0
.end method
